﻿using Gengens.Disk.WebApi.dto;
using Newtonsoft.Json;

namespace Gengens.Disk.WebApi.util
{
    public class LoginUtils
    {
        public static LoginInfo? GetLogInfoFromString(string str) {
            string s = StringUtils.Decrypt(str,MateData.LoginKey);
            return JsonConvert.DeserializeObject<LoginInfo>(s);
            
        }

        public static string GetStringFromLoginfo(LoginInfo info) { 
            string json = JsonConvert.SerializeObject(info);
            return StringUtils.Encrypt(json, MateData.LoginKey);
        }
    }
}
